package de.gameduell.net.src.header {

	/**
	 * @author GD
	 */
	public class Header_V3 implements IHeader {
		
		private const VERSION:int 	    = 3;
		private const DELIMITER:String  = "\t";
		private const TERMINATOR:String = "\n";
		private const PREFIX:String		= "gd";
		
		private var _bodyType:int;
		private var _serviceType:String;
		private var _slotId:String;
		private var _messageId:int;
		private var _ticket:String;
		private var _originalId:int;
		
		public function Header_V3(aBodyVersion:int,aMessageId:int, aServiceType:String, aSlotId:String,aTicket:String) {
			_bodyType 	 = aBodyVersion;
			_serviceType = aServiceType;
			_slotId 	 = aSlotId;
			_messageId   = aMessageId;
			_originalId  = aMessageId;
			_ticket 	 = aTicket;
		}

		public function get content():String {
			var contentList:Array = new Array(PREFIX+VERSION+"."+_bodyType,_serviceType,_slotId,_messageId,_ticket,_originalId);
			return contentList.join(DELIMITER)+TERMINATOR;
		}
		
		public function get version():int{
			return VERSION;
		}
		
		public function get id():int {
			return _messageId;
		}

		public function set id(aId:int):void {
			_messageId = aId;
		} 
		
		public function get bodyType():int {
			return _bodyType;
		}
		
		public function get serviceType():String {
			return _serviceType;
		}
		
		public function get slotId():String {
			return _slotId;
		}
		
		public function get ticket():String {
			return _ticket;
		}
		
	}
}
